<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<script type="text/javascript">
	$(function() {
		//$('#inputForm input').tooltip({'placement':'top'});
		$('#addNodeForm input').tooltip();
		//表单验证
		$('#addNodeForm').checkForm();
		$('#addNodeForm').ajaxForm({
			url : _ctx + "/registry/add_node_info.do",
			type : "post",
			dataType : "json",
			beforeSubmit : function() {
				$("#sbmBtn").attr("disabled", "disabled");
			},
			data: {
				   pid:$("#nodeId").val(),
				   netType:${netType},
				   nodeName:$("#newNodeName").val()
			},
			clearForm : false,
			resetForm : false,
			success : function(resp) {
				if (resp.status == '1') {
					ui.msg(resp.msg, 1);
					ui.go(_ctx + '/registry/node_info_mgr.do');
				} else {
					ui.msg(resp.msg, 0);
				}
				$("#sbmBtn").removeClass("disabled").attr("disabled", null);
			},
			error : function(resp) {
				ui.msg('请求发送失败', 0);
				$("#sbmBtn").removeClass("disabled").attr("disabled", null);
			}
		});
	});
</script>
<form class="form-horizontal" role="form" id="addNodeForm" action=""
	method="post">
	<div class="form-group">
	<c:if test="${isNode eq 0 }">
		<div class="alert alert-warning">
		<div class="col-sm-3 control-label no-padding-right"
			for="form-field-2"></div>
			<i class="icon-exclamation-sign"></i>
			<c:if test="${sessionScope._local_node_session.netType eq '1' }">
				外网节点在内网注册时请保证节点信息一致
			</c:if>
			<c:if test="${sessionScope._local_node_session.netType eq '2' }">
				内网节点在外网注册时请保证节点信息一致
			</c:if>
		</div>
	</c:if>
	<div class="space-4"></div>
	<div class="form-group">
		<div class="col-sm-3 control-label no-padding-right"
			for="form-field-2">行政区*</div>
		<div class="col-sm-4">
			<select name="orgCode" id="orgCode"  orgCode datatype="require" msg="请选择行政区" 
				class="form-control input-sm" >
				<option value=''>-请选择-</option>
				<c:forEach items="${ orgList}" var="vo">
					<option value="${vo.adCd }">${vo.adNm }</option>
				</c:forEach>
			</select>
		</div>
	</div>
	<c:if test="${isNode eq 0 }">
		<div class="space-4"></div>
		<div class="form-group">
			<div class="col-sm-3 control-label no-padding-right"
				for="form-field-1">节点编码 *</div>
			<div class="col-sm-9">
				<input type="text" class="col-xs-10 col-sm-5" name="nodeCode"
					id="nodeCode" datatype="require|limit|ajax"  min="9"  max="9"
					url="${ctx }/registry/is_nodecode_unique.do" oldValue=""  value=""
					placeholder="请输入节点编码"
					msg="请输入节点编码|节点编码长度错误，长度应为[9]！|节点编码重复！" title="必填项,节点编码" />
			</div>
		</div>
	</c:if>
	<div class="space-4"></div>
	<div class="form-group">
		<div class="col-sm-3 control-label no-padding-right"
			for="form-field-1">节点名称 *</div>
		<div class="col-sm-9">
			<input type="text" class="col-xs-10 col-sm-5" name="newNodeName"
				id="newNodeName" datatype="require|limit|ajax"  min="2"  max="50"
				url="${ctx }/registry/is_nodename_unique.do" oldValue=""
				placeholder="请输入节点名称"
				msg="请输入节点名称|节点名称长度错误，长度应为[2~50]！|节点名称重复！" title="必填项,节点名称" />
		</div>
	</div>
	<div class="space-4"></div>
	<div class="form-group">
		<div class="col-sm-3 control-label no-padding-right"
			for="form-field-1">管理员邮箱 *</div>
		<div class="col-sm-9">
			<input type="text" class="col-xs-10 col-sm-5"  name="adminEmail"
				id="adminEmail"  datatype="require|email"  placeholder="请输入管理员邮箱 "
				msg="请输入管理员邮箱 |请输入正确的管理员邮箱"  title="必填项,管理员邮箱 " />
		</div>
	</div>
	<c:if test="${isNode eq 1 }">
		<div class="space-4"></div>
		<div class="form-group">
			<label class="col-sm-3 control-label no-padding-right"
				for="form-field-1">访问地址 *</label>
			<div class="col-sm-9">
				<input type="text" class="col-xs-10 col-sm-5" name="installUrl"
					id="installUrl" datatype="require|ajax" placeholder="例 http://127.0.0.1/turbo " 
					url="${ctx }/registry/check_installUrl.do" 
					msg="请输入访问地址 |访问地址连接失败，请检查！" title="必填项,访问地址 " />
			</div>
		</div>
		<div class="space-4"></div>
		<div class="form-group">
			<div class="col-sm-2 control-label no-padding-right"
				for="form-field-1"></div>
			<div class="col-sm-10">
			注：此地址为项目公网访问地址,例：http://10.1.1.1:8080/turbo
			</div>
		</div>
	</c:if>
	<div class="space-4"></div>
	<div class="form-group">
		<div class="col-sm-3 control-label no-padding-right"
			for="form-field-2">备注</div>
		<div class="col-sm-9">
			<textarea class="col-sm-5" placeholder="请输入备注" name="remark"
				id="remark" title="备注"></textarea>
		</div>
	</div>
	<hr>
	<div class="clearfix form-group">
		<div class="col-md-offset-3 col-md-9">
			<button type="submit" class="btn btn-sm btn-info"  id="sbmBtn"  >
				<i class="icon-ok bigger-110"></i>提交
			</button>
		</div>
	</div>
</form>
